﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace ControlNode
{
    public partial class ControlNode : Form
    {
        internal static int CNodeId;
        private NetworkCallController NCC;
        private ConnectionController CC;
        private Directory Dir;
        private PacketController PC;
        private RoutingController RC;

        public ControlNode()
        {
            InitializeComponent();
            //NCC = new NetworkCallController();
            CC = new ConnectionController();
            Dir = new Directory();
            RC = new RoutingController(this);
            PC = new PacketController();
            PacketController.Log += new PacketController.LogEventHandler(WriteLine);
        }

        public void WriteLine(string message)
        {
            this.Invoke((MethodInvoker)delegate
            {
                string Time = DateTime.Now.ToString("[HH:mm:ss tt] ");
                listBox1.Items.Add(Time + message);
            });
        }

        public static string CNodeID { get; set; }
    }
}
